//
//  MCBodySelectRulerVc.swift
//  MCBodyBuildingPro
//
//  Created by Renlvshijie on 2023/6/10.
//

import UIKit
import JXSegmentedView
import SnapKit
import QMUIKit

//typealias LQAppleLoginCompleteHandler = (_ successed: Bool, _ user: String?, _ familyName: String?, _ givenName: String?, _ email: String?, _ password: String?, _ identityToken: Data?, _ authorizationCode: Data?, _ error: Error?, _ msg: String) -> Void


typealias bodySelectDataInfoHandler = (_ bodyDataInfo:Float) -> Void

class MCBodySelectRulerVc: MCBaseVc {
    
    
    var selectDataInfoHandler:bodySelectDataInfoHandler?
    ///单个显示-各种数据
    lazy var lazyRulerView:DYScrollRulerView = { [unowned self] in
        let unitStr     = "cm"
        let rulerHeight = DYScrollRulerView.rulerViewHeight
        var rulerView   = DYScrollRulerView.init(frame: CGRect.init(x: 5, y: 20, width: Int(ScreenWidth)-20, height: rulerHeight()), tminValue: 10, tmaxValue: 50, tstep: 0.1, tunit: unitStr, tNum:10, viewcontroller:self)
        rulerView.setDefaultValueAndAnimated(defaultValue: 30, animated: true)
        rulerView.bgColor       = UIColor.cyan
        rulerView.triangleColor = UIColor.white
        rulerView.delegate      = self
        rulerView.scrollByHand  = true
       return rulerView
    }()
    
    override func viewDidLoad() {
        super.viewDidLoad()
        self.view.backgroundColor = UIColor.qmui_color(withHexString: "#FFFFFF")
        
        
        self.view.addSubview(lazyRulerView)
        
        
    }
    
 
}

extension MCBodySelectRulerVc:DYScrollRulerDelegate {
    func dyScrollRulerViewValueChange(rulerView: DYScrollRulerView, value: Float) {
        
        self.selectDataInfoHandler?(value)
        
    }
}


extension MCBodySelectRulerVc:JXSegmentedListContainerViewListDelegate {
    func listView() -> UIView {
        return view
    }
}
